<?php 
/**
 * Класс, который реализовует базовые настройки PHP-Ext
 *
 */

class FRM_View_Ext_Form_Template_Realty extends FRM_View_Ext_Form_Template_Abstract
{

	protected  function init(){
		
		$this->zones[0] = new PhpExt_Panel();
		$this->zones[0]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[1] = new PhpExt_Panel();
		$this->zones[1]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[2] = new PhpExt_Panel();
		$this->zones[2]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[3] = new PhpExt_Panel();
		$this->zones[3]->setBorder(false)
					 ->setLabelWidth(5)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[4] = new PhpExt_Panel();
		$this->zones[4]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[5] = new PhpExt_Panel();
		$this->zones[5]->setBorder(false)
						->setLabelWidth(135)
		             	->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[6] = new PhpExt_Panel();
		$this->zones[6]->setBorder(false)
						->setLabelWidth(5)
		             	->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[7] = new PhpExt_Panel();
		$this->zones[7]->setBorder(false)
					 ->setLabelWidth(41)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[8] = new PhpExt_Panel();
		$this->zones[8]->setBorder(false)
					 ->setLabelWidth(210)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[9] = new PhpExt_Panel();
		$this->zones[9]->setBorder(false)
					 ->setLabelWidth(5)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[10] = new PhpExt_Panel();
		$this->zones[10]->setBorder(false)
					 ->setLabelWidth(5)
		             ->setLayout(new PhpExt_Layout_FormLayout());		
		$this->zones[11] = new PhpExt_Panel();
		$this->zones[11]->setBorder(false)
					 ->setLabelWidth(5)
		             ->setLayout(new PhpExt_Layout_FormLayout());	
		$this->zones[12] = new PhpExt_Panel();
		$this->zones[12]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());	
		$this->zones[13] = new PhpExt_Panel();
		$this->zones[13]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());	
		$this->zones[14] = new PhpExt_Panel();
		$this->zones[14]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());	
		$this->zones[15] = new PhpExt_Panel();
		$this->zones[15]->setBorder(false)
		             ->setLayout(new PhpExt_Layout_FormLayout());
		$this->zones[16] = new PhpExt_Panel();
		$this->zones[16]->setBorder(false)
					 ->setLabelWidth(5)
		             ->setLayout(new PhpExt_Layout_FormLayout());
		$this->zones[17] = new PhpExt_Panel();
		$this->zones[17]->setBorder(false);
		
		$tabPanel = new PhpExt_TabPanel();
		$tabPanel 	  ->setPlain(true)
			          ->setActiveTab(0)
			          ->setDeferredRender(false)
			          ->setLayoutOnTabChange(true)
			          ->setAutoWidth(true);	
		$offerPanel = new PhpExt_Panel();
		$offerPanel   ->setTitle("Предложение")
					  ->setLayout(new PhpExt_Layout_ColumnLayout())
					  ->setAutoHeight(true)
					  ->setBorder(false);
		$galeryPanel = new PhpExt_Panel();
		$galeryPanel   ->setTitle("Галерея")
			 		   ->setLayout(new PhpExt_Layout_ColumnLayout())
					   ->setAutoHeight(true)
					   ->setBorder(false);
					   
		$tabPanel ->addItem($offerPanel);
		$tabPanel ->addItem($galeryPanel);
		
		$offerPanel_1 = new PhpExt_Panel();
		$offerPanel_1 ->setLayout(new PhpExt_Layout_ColumnLayout())
					  ->setAutoHeight(true)
					  ->setBorder(false)
					  ->setCssStyle("padding:0px");
	
		$offerPanel -> addItem($offerPanel_1);
		
		
		
		$offerPanel_2_1 = new PhpExt_Panel();
		$offerPanel_2_1	-> setAutoHeight(true)
					 	-> setBorder(false);
		
		$offerPanel_2_2 = new PhpExt_Panel();
		$offerPanel_2_2 -> setAutoHeight(true)
					 	-> setBorder(false);
					 	
		//тип подтип
		$offerPanel_2_1 ->addItem($this->zones[0]); 
		//город район
		$offerPanel_2_2 ->addItem($this->zones[1]); 			  
		
		$offerPanel_1 ->addItem($offerPanel_2_1, new PhpExt_Layout_ColumnLayoutData(0.5));
		$offerPanel_1 ->addItem($offerPanel_2_2, new PhpExt_Layout_ColumnLayoutData(0.5));
		
    	//$offerPanel -> addItem($offerPanel_2);
		
    	$offerPanel_2_2_1 = new PhpExt_Panel();
		$offerPanel_2_2_1 -> setLayout(new PhpExt_Layout_ColumnLayout())
					 	-> setAutoHeight(true)
					 	-> setBorder(false);
		$offerPanel_2_2_2 = new PhpExt_Panel();
		$offerPanel_2_2_2 -> setLayout(new PhpExt_Layout_ColumnLayout())
					 	-> setAutoHeight(true)
					 	-> setBorder(false);
		//цена
		$offerPanel_2_2_1 ->addItem($this->zones[2], new PhpExt_Layout_ColumnLayoutData(0.55)); 
		$offerPanel_2_2_1 ->addItem($this->zones[3], new PhpExt_Layout_ColumnLayoutData(0.45)); 
		$offerPanel_2_2_2 ->addItem($this->zones[4], new PhpExt_Layout_ColumnLayoutData(0.55)); 
		$offerPanel_2_2_2 ->addItem($this->zones[16], new PhpExt_Layout_ColumnLayoutData(0.45)); 
		$offerPanel_2_1 ->addItem($offerPanel_2_2_1);
		$offerPanel_2_2 ->addItem($offerPanel_2_2_2);
		
		$offerPanel_3 = new PhpExt_Panel();
		$offerPanel_3 -> setLayout(new PhpExt_Layout_ColumnLayout())
					  -> setAutoHeight(true)
					  ->setCssStyle("width:100%")
					  -> setBorder(false);
					  
		//$offerPanel -> addItem($offerPanel_3);
		
		//локализация
		if (count($this->langs))
		{
			$tabPanel2 = new PhpExt_TabPanel();
			$tabPanel2 ->setPlain(true)
				          ->setActiveTab(0)
				          ->setHideMode("offsets")
				          ->setDeferredRender(false)
			          	  ->setLayoutOnTabChange(true)
				          ->setAutoWidth(true);

			foreach ($this->langs as $k=>$v) {
				$this->zones[$k] = new PhpExt_Panel();
				$this->zones[$k]   ->setTitle($v)
								   ->setHideMode("offsets")
							       ->setLayout(new PhpExt_Layout_FormLayout())
							       ->setAutoHeight(true)
				          		   ->setCssStyle("padding:10px 10px 0px 10px;");

				$tabPanel2->addItem($this->zones[$k]);
			}
			
			$offerPanel->addItem($tabPanel2);
		}
		
		$tabPanel3 = new PhpExt_TabPanel();
		$tabPanel3 ->setPlain(true)
			          ->setActiveTab(0)
			          ->setDeferredRender(false)
			          ->setLayoutOnTabChange(true)
			          ->setAutoWidth(true)
			          ->setCssStyle("padding:10px 10px 0px 10px;");
		
		$detailsPanel = new PhpExt_Panel();
		$detailsPanel ->setTitle("Детально")
					  ->setLayout(new PhpExt_Layout_ColumnLayout())
					  ->setAutoHeight(true)
				      ->setCssStyle("padding:10px 0px 0px 10px;");
			             
		$optionsPanel = new PhpExt_Panel();
		$optionsPanel ->setTitle("Опции")
					  ->setLayout(new PhpExt_Layout_ColumnLayout())
					  ->setAutoHeight(true)	
					  ->setHideMode("offsets")
					  ->setCssStyle("padding:10px 10px 0px 10px;");
					  
		$ownerPanel = new PhpExt_Panel();
		$ownerPanel ->setTitle("Профайл")
					  ->setLayout(new PhpExt_Layout_ColumnLayout())
					  ->setAutoHeight(true)
					  ->setCssStyle("padding:10px 10px 0px 10px;");
					  
		$tabPanel3 ->addItem($detailsPanel);
		$tabPanel3 ->addItem($optionsPanel);
		$tabPanel3 ->addItem($ownerPanel);
		
		//улица дом метро этаж этажность
		$offerPanel_3 ->addItem($this->zones[5], new PhpExt_Layout_ColumnLayoutData(0.44)); 
		$offerPanel_3 ->addItem($this->zones[6], new PhpExt_Layout_ColumnLayoutData(0.1)); 
		$offerPanel_3 ->addItem($this->zones[7], new PhpExt_Layout_ColumnLayoutData(0.46)); 

		$offerPanel_4 = new PhpExt_Panel();
		$offerPanel_4 -> setLayout(new PhpExt_Layout_ColumnLayout())
					  -> setAutoHeight(true)
					  ->setCssStyle("width:100%")
					  -> setBorder(false);

		$detailsPanel -> addItem($offerPanel_3);
		$detailsPanel -> addItem($offerPanel_4);
		$offerPanel -> addItem($tabPanel3);
				
		//площадь
		$offerPanel_4 ->addItem($this->zones[8]);
		$offerPanel_4 ->addItem($this->zones[9]);
		$offerPanel_4 ->addItem($this->zones[10]);
		$offerPanel_4 ->addItem($this->zones[11]);
		
		$offerPanel_6 = new PhpExt_Panel();
		$offerPanel_6 -> setLayout(new PhpExt_Layout_ColumnLayout())
					  -> setAutoHeight(true)
					  //->setLabelWidth(160)
					  -> setBorder(false);
					  
		$offerPanel_6 ->addItem($this->zones[13], new PhpExt_Layout_ColumnLayoutData(0.33));
		$offerPanel_6 ->addItem($this->zones[14], new PhpExt_Layout_ColumnLayoutData(0.33));
		$offerPanel_6 ->addItem($this->zones[15], new PhpExt_Layout_ColumnLayoutData(0.33));
		
		$optionsPanel -> addItem($offerPanel_6, new PhpExt_Layout_ColumnLayoutData(1));
		
		$offerPanel_5 = new PhpExt_Panel();
		$offerPanel_5 -> setCssStyle("padding-top:5px")
					  -> setAutoHeight(true)
					  -> setBorder(false);
		
		$offerPanel -> addItem($offerPanel_5);
		
		//площадь
		$offerPanel_5 ->addItem($this->zones[12]);
	
		
		$galeryPanel ->addItem($this->zones[17])
					 ->attachListener("activate",new PhpExt_Listener(PhpExt_Javascript::inlineStm("function(tab){Ext.getCmp('galery').items.get(0).store.load();editForm.doLayout();tab.doLayout();}")));
		
		
		$this->form->setBorder(false);
		$this->form->addItem($tabPanel);
	
		
	}
	
}